<div id="picAddress" class="tableform widgetconfig">
  <h4><{t app="b2c"}>基本设置<{/t}></h4>
  <div class="division">
    <table width="100%" cellpadding="0" cellspacing="0">
      <tr>
        <th><{t app="b2c"}>宽度<{/t}></th>
        <td><input name='slideshow_width' value="<{$setting.slideshow_width|default:500}>" size="4">px</td>
        <th><{t app="b2c"}>高度<{/t}></th>
        <td><input name='slideshow_height' value="<{$setting.slideshow_height|default:320}>" size="4">px</td>
      </tr>
      <tr>
        <th><{t app="b2c"}>轮播效果<{/t}></th>
        <td><select name='direction'>
			<option value="scrollx" <{if $setting.direction=='scrollx'}>selected<{/if}>><{t app="b2c"}>左右<{/t}></option>
			<option value="scrolly" <{if $setting.direction=='scrolly'}>selected<{/if}>><{t app="b2c"}>上下<{/t}></option>
			<option value="fade" <{if $setting.direction=='fade'}>selected<{/if}>><{t app="b2c"}>透明<{/t}></option>
			</select>
            </td>
                    <th><{t app="b2c"}>过渡效果<{/t}></th>
        <td><select name='around'>
			<option value=true <{if $setting.around=='true'}>selected<{/if}>><{t app="b2c"}>向前<{/t}></option>
			<option value=false <{if $setting.around=='false'}>selected<{/if}>><{t app="b2c"}>向后<{/t}></option>
			</select>
            </td>
      </tr>
    </table>
  </div>


  <h4><{t app="b2c"}>已添加的图片和文字<{/t}></h4>
  <div class="division">
<div class="piccontent">
  <{foreach from=$setting.pic item=data key=key}>
	  <table  width="100%" cellpadding="0" cellspacing="0">
		  <tr>
		  <th><{t app="b2c"}>图片地址:<{/t}></th>
		  <td><input type=hidden name=pic[<{$data.id}>][id] value="<{$data.id}>"><input name='pic[<{$data.id}>][link]' class="imgsrc" id="pic[<{$data.id}>][link]"  value="<{$data.link}>"><input type=button value=上传图片 class="uploadbtn"></td>
		  <th><{t app="b2c"}>链接地址:<{/t}></th>
		  <td><input name="pic[<{$data.id}>][linktarget]" value="<{$data.linktarget}>"> </td>
		  </tr>
		  <tr>
		  <th><{t app="b2c"}>描述:<{/t}></th>
		  <td><input name="pic[<{$data.id}>][linkinfo]" value="<{$data.linkinfo}>"> </td>
		  <th><{t app="b2c"}>删除该图片及描述:<{/t}></th>
		  <td><span onclick="$(this).getParent('table').destroy()"><{img src="delecate.gif" style="cursor:pointer;" alt=$___b2c="删除"|t:'b2c' title=$___b2c="删除"|t:'b2c'}></span></td>
		  </tr>
	  </table>
<{/foreach}>
</div>
<{button label=$___b2c="添加图片"|t:'b2c' class="addimage" app="desktop" icon="btn_add.gif"}>

</div>
</div>


<script>

(function(){
	var tag_type='table',tag_class='pic_items';

	document.getElement(".addimage").addEvent('click',function(){

			var i=new Date().getTime();

			var tpl='\
				  <tr><th><{t app="b2c"}>图片地址:<{/t}></th>\
					  <td><input type=hidden name=pic['+i+'][id] value="'+i+'"><input name="pic['+i+'][link]" class="imgsrc">\
					  <input type=button value=<{t app="b2c"}>上传图片<{/t}> class="uploadbtn" id="pic['+i+']"></td>\
					  <th><{t app="b2c"}>链接地址:<{/t}></th>\
					  <td><input name="pic['+i+'][linktarget]"></td></tr>\
				  <tr><th><{t app="b2c"}>描述:<{/t}></th>\
					  <td><input name="pic['+i+'][linkinfo]"></td>\
					  <th><{t app="b2c"}>删除该图片及描述:<{/t}></th>\
					  <td><span onclick="$(this).getParent(\'table\').destroy()"><{img src="delecate.gif" style="cursor:pointer;" alt=$___b2c="删除"|t:'b2c' title=$___b2c="删除"|t:'b2c'}></span></td>\
				  </tr>';

			$('picAddress').getElement('.piccontent').adopt(new Element(tag_type,{'html':tpl,'width':'100%','class':tag_class}));

			$('pic['+i+']').addEvent('click',function(e){bindevent(this)});
	});


	$$(".piccontent .uploadbtn").addEvent('click',function(e){bindevent(this)});

	function bindevent(el){
		var target=$(el).getParent(tag_type).getElement('.imgsrc');
		var url='index.php?app=desktop&act=alertpages&goto='+encodeURIComponent("index.php?app=image&ctl=admin_manage&act=image_broswer&type=big");
		return new imgDialog(url,{onCallback:function(image_id,image_src){
				target.value=image_src;
		}})
	}

})();


</script>


